package com.lefevre.cms.bean.user;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户角色组(保存用户所属的角色)
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("user_role_group")
@Entity
@Table(name = "user_role_group", indexes = {@Index(name = "userRoleGroup_1_idx", columnList = "userName,validPeriodEnd"), @Index(name = "userRoleGroup_3_idx", columnList = "userRoleId,userName")})
public class UserRoleGroup implements Serializable {
    private static final long serialVersionUID = -1406832022665184431L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.INPUT)
    private Long id;

    @Column(length = 30)
    private String userName;

    /**
     * 角色Id
     **/
    @Column(length = 32)
    private String userRoleId;

    /**
     * 有效期结束  默认：2999-1-1 0:0
     **/
    @Temporal(TemporalType.TIMESTAMP)
    private Date validPeriodEnd;

}
